package com.linkhub.oms.common.enums.mp;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.linkhub.oms.common.enums.IEnumConvert;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Description: EmployeeBusinessStatusEnum
 * @Author: echo
 * @Date: 2024/3/28 17:08
 * @Version: 1.0
 */
@Getter
@AllArgsConstructor
public enum EmployeeBusinessStatusEnum implements IEnumConvert<Integer> {

    // 【老】员工业务状态：0-客户未履约;1-待审核；2-待预报；3-履约中；4-追踪中；30-异常
    // 【最新】员工业务页签状态：0-客户未履约;50-待审核；55-待预报；60-待打印；65-待推送；70-待打包；75-已出库；80-追踪中；85-已取消；90-异常
    CUSTOMER_NOT_PERFORMING(0, "客户未履约"),
    PENDING_CHECK(50, "待审核"),
    TO_BE_FORECAST(55, "待预报"),
    TO_BE_PRINTED(60, "待打印"),
    TO_BE_PUSHED(65, "待推送"),
    TO_BE_PACKAGED(70, "待打包"),
    OUT_OF_STORAGE(75, "已出库"),
    TRACKING(80, "追踪中"),
    CANCELLED(85, "已取消"),
    ABNORMAL(90, "异常"),
    ;

    @EnumValue
    private final Integer code;
    private final String desc;

    public static boolean isPendingForecast(EmployeeBusinessStatusEnum businessStatus) {
        return checkBizStatus(businessStatus, TO_BE_FORECAST);
    }

    public static boolean isPendingPrint( EmployeeBusinessStatusEnum businessStatus ) {
        return checkBizStatus(businessStatus, TO_BE_PRINTED);
    }

    public static boolean isPendingPushToWms( EmployeeBusinessStatusEnum businessStatus ) {
        return checkBizStatus(businessStatus, TO_BE_PUSHED);
    }

    public static boolean checkBizStatus(EmployeeBusinessStatusEnum businessStatus, EmployeeBusinessStatusEnum target) {
        return Objects.equals(businessStatus, target);
    }

}
